home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9795 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: cc2000.kyoto-su.ac.jp!usenet
  2. From: Phil Boyd <boydp@hdc-usa.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: A question on for loop
  5. Date: Wed, 13 Mar 1996 10:35:32 -0800
  6. Organization: Horizon Data Corporation
  7. Message-ID: <31471574.79D9@hdc-usa.com>
  8. NNTP-Posting-Host: 150.226.19.37
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (Win16; I)
  13.  
  14. Jonas J. Schlein wrote:
  15. > Murali Chari <murali@sooraj.ebay.sun.com> wrote:
  16. > |> In the following piece of code:
  17. > |>
  18. > |> for(i=0;i< 20; i++)
  19. > |> {
  20. > ...
  21. > |>   if(condition==FALSE)
  22. > |>   continue;
  23. > ...
  24. > |> }
  25. > |>
  26. > |> Let us assume i=10 before it entered the loop.
  27. > |> The condition was false. So the continue statement
  28. > |> got executed.
  29. > |>
  30. > |> Will control now go to the third statement in the for loop?
  31. > |> i.e. will i be incremented by 1 and again tested for the condition?
  32. > Continue does exactly that. It says continue to the next loop iteration.
  33. > Do not pass go do not pass $200 ;-). So, yes 'i' will be incremented
  34. > and tested again. I'll just assume that FALSE is defined somewhere
  35. > as well as 'condition'.
  36. > --
  37. > "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  38. > Jonas J. Schlein  (schlein@gl.umbc.edu)
  39.  
  40. OK, now for a newbie question just for my own edification:
  41.  
  42. Inside the for loop - does "i" start off with the value 0 so that
  43. the loop has the potential to repeat up to 20 times (assuming that
  44. "condition" remains FALSE)?
  45.  
  46. Thanks for the help
  47.